home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / scrn11 / demo.c next >
Text File  |  1987-06-30  |  8KB  |  236 lines

  1. /*****************************************************************************/
  2. /*                                                                           */
  3. /*                          DEMO FOR SCRNLIB release 1                       */
  4. /*                                                                           */
  5. /*                                                                           */
  6. /*****************************************************************************/
  7. #include "scrnlib.h"
  8.  
  9.      char  scn1[4002];
  10.     char  scn2[450];
  11.  
  12. main()
  13. {
  14.     int   i, jkl;
  15.         char  a,x;
  16.  
  17. /* page 1 */
  18.     setattr(0,9);  /* blinking black on blue */
  19.     cls();      /* clear screen */
  20.     gotoxy(25,10); /* put cursor near middle of screen */
  21.     cursoff();     /* turn off cursor */
  22.     printsh("WELCOME TO THE SCRNLIB DEMO"); /* print opening */
  23.     beep();
  24.       gotoxy(25,24);  /* place cursor on bottom of screen */
  25.     setattr(1,7);  /* blue,white */
  26.     printsh("hit any key to continue ...");
  27.     keywait();     /* wait for user input */
  28.  
  29. /* page 2 */
  30.         setattr(4,7);  /*red on white*/
  31.     cls();
  32.         gotoxy(12,3);
  33.     printsh("SCRNLIB HAS WHAT YOU NEED FOR SCREEN MANIPULATION !!");
  34.         gotoxy(1,8);
  35.         printsh("SCRNLIB was developed for the person who needs the power to");
  36.         printsh(" control all aspects \n of a text screen including the ability");
  37.         printsh(" to do windowing.");
  38.         gotoxy(25,24);
  39.     printsh(" hit any key to continue ...");
  40.         keywait();
  41.  
  42. /* page 3 */
  43.         cls();
  44.         setattr(1,7);
  45.         gotoxy(5,2);
  46.         printsh("This demo contains a series of screen manipulations to illustrate\n");
  47.         printsh("the powers of the SCRNLIB routines.  There are numerous pauses throughout\n");
  48.         printsh("these procedures to allow you to observe each new screen output.  Each\n");
  49.         printsh("requires only a single stroke of any key to move on.\n\n");
  50.         printsh("     So, just rest your fingers on the spacebar, or any other of your favorite\n");
  51.         printsh("keys, sit back and enjoy the ride.");
  52.         gotoxy(20,24);
  53.         printsh("p.s.  This is one of those pauses.");
  54.         keywait();
  55.  
  56. /* page 4 */
  57.         setattr(0,7);/*for the monochromes.So they don't underline the entire screen*/
  58.         cls();
  59.         setattr(6,3); /* brown,cyne */
  60.         gotoxy(3,10);
  61.     printsh("MOST SCRNLIB FUNCTIONS WERE WRITTEN IN ASSEMBLY FOR SPEED AND EFFICIENCY");
  62.         gotoxy(21,15);
  63.      keywait();
  64.     printsh("THE FUNCTIONS LET YOU BE CREATIVE!");
  65.     keywait();
  66.  
  67. /* page 5 */
  68.         setattr(2,7); /*green on white*/
  69.         cls();
  70.         setattr(11,0);
  71.         i=2;
  72.         for (jkl=2;jkl<23;jkl++,i+=3){
  73.             gotoxy(i,jkl);
  74.             printsh("cursor positioning");
  75.         } /* end for */
  76.         setattr(2,7); /* green,white */
  77.           i=2;
  78.           for (jkl=2;jkl<23;jkl++,i+=3){
  79.             gotoxy(i,jkl);
  80.             printsv("cursor positioning");
  81.           } /* end for */
  82.           gotoxy(55,8);
  83.           printsh("... with color !!");    
  84.         scrnsavd(scn1,0,0,79,24);
  85.         keywait();
  86.  
  87. /* page 6 */
  88.     cls();
  89.     setattr(13,0);  /* magenta,green */
  90.     gotoxy(28,10);
  91.     printsh("SAVE SCREENS EASILY");
  92.     keywait();
  93.  
  94. /*return of page 5 */
  95.     scrnrstd(scn1,0,0);
  96.         setattr(1,15);
  97.     gotoxy(35,5);
  98.     printsh("AND RESTORE THEM EASILY TOO!");
  99.         gotoxy(25,22);
  100.         printsh("remember this screen ?");
  101.         scrnsavd(scn1,0,0,79,24);
  102.         keywait();
  103.  
  104. /* page 7 */
  105.         setattr(7,0); /* light blue,red  */
  106.         cls();
  107.         gotoxy(35,1);
  108.         printsh("WINDOWING");
  109.         keywait();
  110.         setattr(7,0);
  111.         window(10,10,34,19,2); /* open a window and put a double border around it*/
  112.         gotoxy(14,12);
  113.     cls();
  114.     gotoxy(14,11);
  115.         printsh("USE  WINDOWS");
  116.         keywait();
  117.         gotoxy(14,14);    
  118.         printsh("ENHANSED WITH");
  119.         keywait();
  120.         gotoxy(14,16);
  121.         setattr(9,0);
  122.         printsh("COLOR!!");
  123.         keywait();
  124.         cls();
  125.         gotoxy(15,15);
  126.         printsh("SCROLLING");
  127.     keywait();
  128.     gotoxy(18,15);
  129.     printmcv("u",5);
  130.     gotoxy(19,15);
  131.     printmcv("p",5);
  132.     keywait();
  133.     scrlup(5);
  134.     keywait();
  135.         gotoxy(14,15);
  136.         printsh("or SCROLL DOWN");
  137.         keywait();
  138.         scrldn(4);
  139.         keywait();
  140.     window(0,0,79,24,0);
  141.         gotoxy(12,8);
  142.         printsh("or even SCROLL IT ALL ");
  143.         setattr(7,0);
  144.         keywait();
  145.         scrldn(4);
  146.         keywait();
  147.         window(36,7,76,23,0);
  148.         gotoxy(36,7);
  149.         setattr(9,0);
  150.         printsh("Windows can be created to allow screen   output to the windowed area only.");
  151.         printsh("  The   window on the left was activated and the border drawn with one simple command:\n\n");
  152.         printsh("\twindow(10,10,20,20,2);\n\n");
  153.         printsh("Now you are in an editor created with thecommands:\n  do  {\n");
  154.         printsh("      a=getkey();\n      putsch(&a);\n  } while (a != 'X');\n");
  155.         printsh("Putsch knows when to return to the next  line and when to scroll up.");
  156.         setattr(14,0);
  157.         printsh("\nType in it for a while.  Then, just type a capital 'X' to get out.");
  158.         scrnsavd(scn2,9,9,22,22);
  159.         setattr(5,0);
  160.         window(10,10,20,20,2);    /* open window for editor */
  161.         setattr(13,4);
  162.         cls();
  163.         curson();
  164.         do  {
  165.            a=getkey();
  166.            putsch(&a);
  167.         } while (a != 'X');
  168.         cursoff();
  169.         window(0,0,79,24,0); /* set active window to the entire screen*/
  170.         setattr(9,0);
  171.         printsh("The area under the screen was stored previously with the scrnsavd command:\n");
  172.         printsh("\tscrnsavd(scn2,9,9,22,22);\n");
  173.         printsh("it can easily be restored with the scrnrstd command:\n");
  174.         printsh("\tscrnrstd(scn2,9,9);");
  175.         keywait();
  176.         scrnrstd(scn2,9,9);
  177.         keywait();
  178.         printsh("\n\nDon't forget, we can restore entire screens also!");
  179.         keywait();
  180.  
  181. /* again, the return of page 5 */
  182.         scrnrstd(scn1,0,0);
  183.         keywait();
  184.  
  185. /* page 8 */
  186.         setattr(5,0);
  187.         cls();
  188.         window(1,1,78,23,1);/*window the entire screen except for the outer edge*/
  189.                             /*and put a border around it*/
  190.         gotoxy(28,7);
  191.         printsh("SCRNLIB also gives you -");
  192.         setattr(4,2);
  193.         gotoxy(16,10);
  194.     printsh("   P R I N T I N G     F L E X I B I L I T Y   ");
  195.         keywait();
  196.  
  197. /* page 9 */
  198.         setattr(7,0); /*So the screen is not all underlined on monochromes*/
  199.         cls();
  200.         setattr(1,0);
  201.         gotoxy(16,12);
  202.         printsh(" P R I N T I N G      F L E X I B I L I T Y   ");
  203.         gotoxy(16,5);
  204.         setattr(1,7);    
  205.         printsh(" P R I N T   T E X T  H O R I Z O N T A L L Y ");
  206.         setattr(1,0);
  207.         keywait();
  208.         setattr(4,0);
  209.         gotoxy(4,4);
  210.         printsv("or print vertically");
  211.         gotoxy(71,4);
  212.         printsv("or print vertically");
  213.         setattr(2,0);
  214.     gotoxy(15,23);
  215.     printsh("One command for each purpose to make it EASY!!!");
  216.     keywait();
  217. /* 10th and final page */
  218.         cls();
  219.         gotoxy(30,2);
  220.         printsh("Dave Millis");
  221.         gotoxy(30,3);
  222.         printsh("P.O. Box 2371");
  223.         gotoxy(30,4);
  224.         printsh("Glenview, Illinois  60025");
  225.     setattr(9,0);
  226.     gotoxy(1,10);
  227.     printsh("SCRNLIB is an easy solution to the problems of controlling text ");
  228.     printsh("on the\n\nscreen.  This package enables you to write code");
  229.     printsh(" which is not only efficient \n\nbut also very creative.  ");
  230.     printsh("TRY OUT SCRNLIB and if you find it helpful, just \n\nsend me $10 ");
  231.         printsh("to become a registered user.");
  232.         keywait();
  233.         gotoxy(78,23);
  234.         curson();
  235.                 
  236. }